import request from "@/axios/request";
import url from "@/axios/url";
const { mesUrl, adminUrl } = url();
// 导出url
export const exportUrl = `${mesUrl}mesScanRecordDefective/export`;

export const repairExportUrl = `${mesUrl}mesScanRecordDefective/repairExport`;
// 分页查询
export function getList(params = {}) {
  return request({
    url: `${mesUrl}mesScanRecordDefective`,
    method: "get",
    params,
  });
}
// 新增
export function rowCreate(data = {}) {
  return request({
    url: `${mesUrl}mesScanRecordDefective`,
    method: "post",
    data,
  });
}
// 修改
export function rowUpdate(data = {}) {
  return request({
    url: `${mesUrl}mesScanRecordDefective`,
    method: "put",
    data,
  });
}
// 生成评审单
export function createReview(id) {
  return request({
    url: `${mesUrl}mesScanRecordDefective/${id}`,
    method: "put",
  });
}
// 详情
export function rowDetail(id) {
  return request({
    url: `${mesUrl}mesScanRecordDefective/info/${id}`,
    method: "get",
  });
}

// 导入用户
export function importData(data = {}) {
  return request({
    url: `${mesUrl}mesScanRecordDefective/import`,
    method: "POST",
    data,
    headers: {
      "Content-Type": "multipart/form-data",
    },
  });
}
// 下载模板
export const downloadTemplateUrl = `${mesUrl}mesScanRecordDefective/template`;

// 查询是否生成评审单（0-否；1-是）列表
export function getIsReviewList() {
  return request({
    url: `${adminUrl}dict/type/yes_or_not`,
    method: "get",
  });
}
// 新增不良评审单
export function mesDefectiveReview(data) {
  return request({
    url: `${mesUrl}mesDefectiveReview`,
    method: "post",
    data,
  });
}
// 根据线体、工序获取工位列表
export function getCellList(data) {
  return request({
    url: `${mesUrl}mesProcessCell/getCellList`,
    method: "post",
    data,
  });
}
// 获取工序列表
export function getRepairProcessList(data) {
  return request({
    url: `${mesUrl}mesProcess/getRepairProcessList`,
    method: "post",
    data,
  });
}
// 根据工位获取设备
export function commonBaseEquipmentModelingList(data) {
  return request({
    url: `${adminUrl}commonBaseEquipmentModeling/list`,
    method: "get",
    params: data,
  });
}
// 返修上线-提交
export function submitRepair(data) {
  return request({
    url: `${mesUrl}mesScanRecordDefective/submitRepair`,
    method: "post",
    data,
  });
}
// 根据车间编码查询制造模型列表
export function getModelSetting(params) {
  return request({
    url: `${adminUrl}commonManufacturingModel`,
    method: "get",
    params,
  });
}
// 根据车间编码查询设备列表
export function getEquipmentList(params = {}) {
  return request({
    url: `${mesUrl}mesTechnologyProcessEquipment/getEquipmentByTech`,
    method: "get",
    params,
  });
}
